<!--#include file="../inc/easp/easp.asp"-->
<!--#include file="../inc/conn1.asp"-->
<!--#include file="../inc/checklogin.asp"-->
<!--#include file="../inc/easyide.asp"-->
<% CheckLogin("../index.asp") %>
<%
  dim rs
  dim y_id,g_id,holinum,operate
  y_id = Easp.Get("y_id")'获取要操作的国家ID
  g_id = Easp.Get("g_id")'获取分组ID
  holinum = trim(Easp.Get("holinum"))'Holiday个数
  
  if holinum = "" then holinum = "20"	'默认20个
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Holiday Details</title>
<link rel="stylesheet" type="text/css" href="../css/theme.css" />
<link rel="stylesheet" type="text/css" href="../css/style.css" />
<script type="text/javascript">
	var StyleFile = "theme" + document.cookie.charAt(6) + ".css";
	document.writeln('<link rel="stylesheet" type="text/css" href="../css/' + StyleFile + '">');
</script>
<!--[if IE]>
<link rel="stylesheet" type="text/css" href="css/ie-sucks.css" />
<![endif]-->
</head>
<body>
<div id="container">
	<div id="header">
    <div id="divAccount" style="float:right;">
        <a href="../user/account.asp" style="color:white">Account</a>&nbsp;&nbsp;&nbsp;&nbsp;
        <a href="../inc/logout.asp" style="color:white">Logout</a>
      </div>
		<h2>Holiday Details</h2>
		<div id="topmenu">
			<ul>
				<li><a href="../main.asp">Home</a></li>
				<%				
				   If Session("Authority")="0" Then 
				     Easp.wc "<li><a href='../Country/index.asp'>Country</a></li>"
				   End if
				%>
				<li class="current"><a href="#">Holiday</a></li>
				<li><a href="../Times/index.asp">Times</a></li>
				<li><a href="../wallboard/index.asp">WallBoard</a></li>
				<%
				   If Session("Authority")="0" Then 
				       Response.Write("<li><a href='../user/index.asp'>User</a></li>")
				   End if
				%>
				<li><% If Session("Passed")=true Then %><a href="../inc/logout.asp">Logout</a><% End If %></li>
			</ul>
		</div>
	</div>
	<div id="top-panel">
		<div id="panel">
			<ul>
				<li><a href="<%=request.serverVariables("Http_REFERER")%>" class="goback">GoBack</a></li>
			</ul>
		</div>
	</div>
	<div id="wrapper">
		<div id="content">
			<form id="form" action="Holiday.asp" method="post" onSubmit="return checkform(this)">
				<div id="box">
					<%
					  dim rs1,rs2
					  dim countryName,groupName
					  Set rs1 = Easp.db.GetRecordBySql("select * from Country where y_id=" & y_id & "")					  
					  If not Easp.IsN(rs1) Then
					  	countryName = trim(rs1("CountryName"))
					  End If
					  Easp.db.C(rs1)
					 
					  Set rs2 = Easp.db.GetRecordBySql("select * from [Group] where ID=" & g_id & "")
					  if not Easp.IsN(rs2) Then
					  	groupName = trim(rs2("GroupName"))
					  End if					  
					  Easp.db.c(rs2)					 
					  Easp.wc "<h3>Details - " & countryName & " - " & groupName & "</h3>"
					%>					
					<table width="100%" style="text-align: center;">
						<thead>
							<tr>
								<th width="81" class="a-center"><a href="#">NO.</a></th>
								<th width="360"><a href="#">YYYY/MM/DD</a></th>
								<th width="81" class="a-center"><a href="#">NO.</a></th>
								<th width="360"><a href="#">YYYY/MM/DD</a></th>
							</tr>
						</thead>
						<tbody>
						<%
						'获取对应组的存放目录
						  dim rsgroup,savepath
						  savepath = ""
						  set rsgroup = Easp.db.GetRecordBySql("select * from [Group] where ID=" & g_id)
						  if not Easp.IsN(rsgroup) Then
						  	savepath = Trim(rsgroup("SavePath"))	
						  	if right(savepath, 1) <> "/" and right(savepath, 1) <> "\" then
  	              savepath = savepath & "/"
                end if					  	
						  end if
						  Easp.db.C(rsgroup)
						  
						  '计算条数{{
						  dim itemnum
						  if is_odd(holinum) then
						  	itemnum = int(holinum / 2) + 1
						  else
						  	itemnum = holinum / 2
						  end if				   
						  'die itemnum
						  '}}
						
						        dim i,ii						  
						  	    '修改已有记录		
						  	     Set rs = Easp.db.GetRecordDetail("Country", Array("y_id:" & y_id, "g_id:" & g_id))			 	    
						  	    If Not Easp.IsN(rs) Then
						  	    	dim holidayFile,Flag
						  	    	holidayFile = Trim(rs("HolidayFile"))									
						  	    	If holidayFile <> "" Then		
						  	    		holidayFile = savepath & holidayFile		  	    		
						  	    		If file_exists(holidayFile) Then
						  	    	  	Flag = true
						  	    	  	
						  	    	  	dim doc
						  	    	  	Set doc = xml_load(holidayFile)
						  	    	  	for i = 1 to itemnum
							            ii = i + itemnum
							              Easp.wc "<tr>"
							              Easp.wc "<td class=""a-center"">" & i & "</td>"
							              Easp.wc "<td><input name=""holiday" & i & """ id=""holiday" & i & """ type=""text"" tabindex=""1"" class=""ipt"" value='" & doc.ChildNodes.item(i-1).Text & "' disabled=""disabled"" hidefocus /></td>"
							              Easp.w "<td class=""a-center"">" 
							                if ii <= Int(holinum) then Easp.w ii
							              Easp.w "</td>"
							              Easp.w "<td>"
							                if ii <= Int(holinum) then Easp.w "<input name='holiday" & ii & "' id='holiday" & ii & "' type='text' tabindex='1' class='ipt' value='" & doc.ChildNodes.item(ii-1).Text & "' disabled='disabled' hidefocus />"
							              Easp.w "</td>"
							              Easp.wc "</tr>"
							            next	
							            Set doc = nothing
						  	      	Else'文件不存在
						  	      		Flag = false
						  	    		  'Easp.we "Open File Failed!"										  
						  	        End If
						  	      Else
						  	      	Flag = false
						  	      End If  
						  	      Easp.db.C(rs)
 						  	    
 						  	      If Flag = false Then 						  	      	
						  	    	  for i = 1 to itemnum
							            ii = i + itemnum
							            Easp.wc "<tr>"
							            Easp.wc "<td class=""a-center"">" & i & "</td>"
							            Easp.wc "<td><input name=""holiday" & i & """ id=""holiday" & i & """ type=""text"" tabindex=""1"" class=""ipt"" disabled=""disabled"" hidefocus /></td>"
							            Easp.w "<td class=""a-center"">" 
							              if ii <= Int(holinum) then Easp ii
							            Easp.w "</td>"
							            Easp.w "<td>"
							            if ii <= Int(holinum) then Easp.w "<input name='holiday" & ii & "' id='holiday" & ii & "' type='text' tabindex='1' class='ipt' disabled='disabled' hidefocus />"
							            Easp.w "</td>"
							            Easp.wc "</tr>"
							          next
 						  	      End If						  	    	
						  	    End If													
						%>
						</tbody>
					</table>
					<div id="pager">						
						
					</div>
				</div>
			</form>
		</div>
	</div>
	<!--#include file="../inc/footer.asp" -->
</div>
</body>
</html>
